cap cd "C:\Users\ejm5\Dropbox\PAPI conjoint\Replication"
cap cd "/Users/paulschuler/Dropbox/projects/PAPI conjoint\Replication"
use PAPI_Conjoint_3years.dta, clear
set more off
 
tab year
lab var party "Party Member"

mvdecode d101* d305* vote, mv(888=.b\999=.c)


#delimit;
label values a011 perform;
label define perform 0 "Very Bad" 1 "Bad" 2 "Neutral" 3"Good" 4"Very Good";


#delimit;
generate treatment_experience=1 if vote_exp !=.;
replace treatment_experience=0 if vote_exp ==.;
lab var treatment_experience "Exposed to Candidates' Experience?";
label values treatment_experience experience;
label define experience 0 "No" 1 "Yes";

lab var no_policy "Exposed to Candidates' Policies?";
label values no_policy no_policy;
label define no_policy 0 "Policy Stated" 1 "No Policy";

lab var party "Candidate is Party Member";
label values party party;
label define party 0 "Non-Party" 1 "Party";

tabstat a009, by(a009);
tabstat a008a, by(a008a);


#delimit;
rename a001 male2;
replace male2=0 if male2==2;
svy: reg male2 i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) replace;

#delimit;
svy: reg a002 i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;

#delimit;
svy: reg a003 i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;


#delimit;
svy: reg a004a i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;

#delimit;
rename a005 kinh;
replace kinh=0 if kinh==7;
svy: reg kinh i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;


#delimit;
svy: reg a006 i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;


#delimit;
svy: reg a007 i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;


#delimit;
generate farmer=1 if a008a==16;
replace farmer=0 if farmer==.;
svy: reg farmer i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;

#delimit;
generate professional=1 if a008a==11|a008a==12|a008a==13;
replace professional=0 if professional==.;
svy: reg professional i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;


#delimit;
generate government=1 if a009==4;
replace government=0 if government==.;
svy: reg government i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;


#delimit;
generate SOE=1 if a009==22|a008a==32;
replace SOE=0 if SOE==.;
svy: reg SOE i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;

#delimit;
generate private=1 if a009==21|a008a==31;
replace private=0 if private==.;
svy: reg private i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;

#delimit;
svy: reg a016_opt1 i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;

#delimit;
svy: reg a016_opt7 i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;


#delimit;
svy: reg d101d5a i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) ;

#delimit;
svy: reg d101d5b i.no_policy##treatment_experience if year==2018;
outreg2 using "Tables\AppendixK", tdec(3) bdec(3) e(rmse N_clust N_strata N_psu N_poststrata) excel ;











